package com.chencs.app.special.controller;
import com.chencs.app.special.service.AppSpecialService;
import com.chencs.vo.net.request.RequestBase;
import com.chencs.vo.net.request.SpecialRequest;
import framework.model.ResponseOptUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by fangzehua on 2017/7/12.
 */

@RestController
@RequestMapping("/app/special")
public class AppSpecialController {


    @Autowired
    private AppSpecialService appSpecialService;

    /**
     * 获取专题列表
     * @return
     */
    @RequestMapping(value = "/getSpecialList", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getSpecialList(@RequestBody RequestBase request){
        String retStr = "";
        try {
            retStr = appSpecialService.getSpecialList(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }

    /**
     * 获取專題詳情
     * @return
     */
    @RequestMapping(value = "/findSpecial", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String findSpecial(@RequestBody SpecialRequest request){
        String retStr = "";
        try {
            retStr = appSpecialService.findSpecial(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }


    /**
     *
     * @return
     */
    @RequestMapping(value = "/findSpecialProBySid", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String findSpecialProBySid(@RequestBody SpecialRequest request){
        String retStr = "";
        try {
            retStr = appSpecialService.findSpecialProBySid(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }
}
